package br.folhapgto.dao.banco;

import java.sql.Connection;  
import java.sql.DriverManager;  
import java.sql.SQLException;  

public class Conexao {
	
	private static Conexao instanciaUnica = new Conexao();

    public static Conexao getInstanciaUnica() {
        return instanciaUnica;
    }

    private Conexao() {
    }
	
	public Connection criaConexao() {

        Connection conn = null;

        try {
            Class.forName("org.gjt.mm.mysql.Driver");
            System.out.println("Driver registrado.");
            conn = DriverManager.getConnection(
                    "jdbc:mysql://localhost/folhapgtodb",
                    "root",
                    "1234");
            System.out.println("Conexão efetuada.");
        } catch (ClassNotFoundException ex) {
            System.out.println("Driver do banco nao encontrado.");
        } catch (SQLException ex) {
            System.out.print("Erro ao obter conexao: " + ex.getMessage());
        }

        return conn;

    }

}
